cmake_minimum_required(VERSION 3.10)

#project(hplcproxy)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O0 -fPIC")

#file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/include/HPLCProxy.h" DESTINATION ${CMAKE_INCLUDE_PATH})
#file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/include/HPLCPacketManager.h" DESTINATION ${CMAKE_INCLUDE_PATH})

aux_source_directory(./src SRC)

#include_directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

#library_directories
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)

#add_executable(hplcproxy ${SRC}) # 生成可执行文件
#add_library(hplcproxy STATIC ${SRC}) # 生成静态库
add_library(hplcproxy SHARED ${SRC}) # 生成动态库或共享库
SET_TARGET_PROPERTIES(hplcproxy PROPERTIES VERSION 1.0.0 SOVERSION 1)

#TARGET_LINK_LIBRARIES(hplcproxy xxx.so)

install(TARGETS hplcproxy 
        LIBRARY DESTINATION ${CMAKE_LIBRARY_PATH})


add_custom_command(TARGET  hplcproxy
        POST_BUILD
        COMMAND echo "hplcproxy builded finished."
        #COMMAND ${CMAKE_COMMAND} -E copy  "${CMAKE_CURRENT_SOURCE_DIR}/include/global.h" ${CMAKE_INCLUDE_PATH}/global.h
#        COMMAND ${CMAKE_COMMAND} -E copy  $<TARGET_FILE:hplcproxy> ${CMAKE_LIBRARY_PATH}/libhplcproxy.so 
#        COMMENT  "hplcproxy is install finished"
       )